package exception;
//编译异常和运行异常

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo02 {
    public static void main(String[] args) {
        method();

        try {
            method2();
        } catch (ParseException e) {
            e.printStackTrace();
        }

    }

    //编译异常
    public static void method2() throws ParseException {
        String s="2048-08-09";
        SimpleDateFormat sbf=new SimpleDateFormat("yyyy-MM-dd");
        Date d=sbf.parse(s);

    }



    //运行异常
    public static void method(){
        try {
            int[]arr={1,2,3};
            System.out.println(arr[3]);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
